package user_information;

import python_alog.Get_resume;

public class Resume implements Get_resume{
	//简历人姓名
	String name = null;
	
	public String name() {
		return name;
	}
	//简历人年龄
	int age = -1;
	public int age() {
		return age;
	}
	//简历人最终毕业院校
	String end_school = null;
	public String end_school() {
		return end_school;
	}
	//简历人最高学历，-1表示没有初始化，
	//1表示大学/专以下，2表示大学/专，3表示硕士，4表示博士
	int highest_school = -1;
	public int highest_school() {
		return highest_school;
	}
	//简历人工作年限
	int working_age = -1;
	public int working_age() {
		return working_age;
	}
	//简历人是否毕业/为应届生
	int whe_gratitued = -1;
	public int whe_gratitued() {
		return whe_gratitued;
	}
	//系统使用者用户名,一般为空
	String username = null;
	
	public Resume() {
		// TODO 自动生成的构造函数存根
		
	}
	
	public Resume(String name_, int age_, String end_school_,
			int highest_school_, int whe_gratitued_)
	{
		//不接受数据不全的？
		if(name_!=null&&end_school_!=null)
		{
			name = name_;
			age = age_;
			end_school = end_school_;
			highest_school = highest_school_;
			whe_gratitued = whe_gratitued_;
			
		}
		else {
			
		}
	}
	public static String[] trans_output(String output_py) {
		int t = output_py.length();
		String ans[] = new String[5];
		int ji = 0;
		for (int i = 0; i < output_py.length(); i++) {
			System.out.println(output_py.charAt(i));
			if(output_py.charAt(i)=='1')
			{
				i+=2;
				String new_str = "";
				while (i<output_py.length()&&output_py.charAt(i)!=' ') {
					new_str+=output_py.charAt(i);
					i++;
				}
				ans[ji++] = new_str;
			}
			else
			{
				ans[ji++] = "";
				while (output_py.charAt(i)!=' '&&i<output_py.length()){i++;};
			}
		}
		return ans;
	}
	public static int highest_edu(String edu_) //1表示大学/专以下，2表示大学/专，3表示硕士，4表示博士
	{
		if (edu_ == "大学"|| edu_ == "大专") {
			return 2;
		}
		else if(edu_ == "硕士")
		{
			return 3;
		}
		else if(edu_ == "博士")
		{
			return 4;
		}
		else {
			return 1;
		}
	}
	public void Resume_init(String[] list) {
		name = list[0];
		age = Integer.parseInt(list[1]);
		end_school = list[2];
		highest_school = highest_edu(list[4]);
		
	}
	public Resume(String file_resume_path) {
		Resume_init(trans_output(algo_(file_resume_path)));
	}	
}
